<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/22 0022
 * Time: 14:39
 */

namespace app\common\model\common;

use app\common\model\TimeModel;

class Categories extends TimeModel
{

    //子分类
    public function childs()
    {
        return $this->hasMany('app\common\model\common\Categories','parent_id','id')->field('id,name,parent_id');
    }

    //所有子类
    public function allChilds()
    {
        return $this->childs()->with('allChilds');
    }
}